from paste.script import templates
from paste.util.template import paste_script_template_renderer

from clutch.crypto import gen_nonce_str

class ProjectTemplate(templates.Template):
    summary = 'Template for creating a basic Clutch project with a single (embedded) application'
    required_templates = ['application']
    _template_dir = 'paster_templates/project'
    template_renderer = staticmethod(paste_script_template_renderer)
    vars = [
        templates.var('session_secret', 'HTTP session secret key', gen_nonce_str()),
        templates.var('session_validate', 'HTTP session valiadation key', gen_nonce_str(8)),
        ]

class ApplicationTemplate(templates.Template):
    summary = 'Template for creating a basic Clutch application package'
    required_templates = []
    _template_dir = 'paster_templates/application'
    template_renderer = staticmethod(paste_script_template_renderer)
    vars = [
        # Clutch-specific variables
        templates.var('html_engine', 'Default HTML Template Engine', 'genshi'),
        templates.var('text_engine', 'Default Text Template Engine', 'jinja'),
        templates.var('db_uri', 'Database URI', 'sqlite:///%(here)s/../devdata.db'),
        templates.var('db_prefix', 'Database Table Prefix', ''),
        # Inherited from basic template
        templates.var('version', 'Version (like 0.1)'),
        templates.var('description', 'One-line description of the package'),
        templates.var('long_description', 'Multi-line description (in reST)'),
        templates.var('keywords', 'Space-separated keywords/tags'),
        templates.var('author', 'Author name'),
        templates.var('author_email', 'Author email'),
        templates.var('url', 'URL of homepage'),
        templates.var('license_name', 'License name'),
        templates.var('zip_safe', 'True/False: if the package can be distributed as a .zip file', default=False),
        ]

